package com.sfx.shortLink.mq.producer;


import com.sfx.shortLink.common.constants.RedisKeyConstant;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@RequiredArgsConstructor
public class ShortLinkStatsSaveProducer {

    private final StringRedisTemplate stringRedisTemplate;

    /**
     * 发送消息
     *
     * @param producerMap 参数-具体的消息封装成一个map
     */
    public void send(Map<String, Object> producerMap) {
        stringRedisTemplate.opsForStream().add(RedisKeyConstant.SHORT_LINK_STATS_STREAM_TOPIC_KEY, producerMap);
    }
}